package main

import (
	"net/http"
	"fmt"
	"strconv"
)

var writera http.ResponseWriter
var i int64 = 0

type Myrequest struct {
	writer  http.ResponseWriter
	content string
}

func main() {

	http.HandleFunc("/", func(writer http.ResponseWriter,
		request *http.Request) {
		fmt.Println("请求:", (i))
		i++
		writera = writer
		name := request.FormValue("name")
		myrequest := Myrequest{writera, "CONTENT" + name}

		outHtml(myrequest)
	})

	port2 := 82
	fmt.Println("http://localhost:" + strconv.Itoa(port2))

	http.ListenAndServe(":"+strconv.Itoa(port2), nil)

}
func outHtml(myr Myrequest) {
	fmt.Fprintln(myr.writer, myr.content)
}
